package project.epam.facultative.app.domain;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import project.epam.facultative.app.domain.Training;

@Entity
@Table(name = "facultatives")
public class Facultative {

	@Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "FACULTATIVE_ID")
	private Integer facultativeId;
	
	@Column(name="NAME")
	private String name;
	
	@OneToMany(targetEntity = Training.class, mappedBy = "facultative", fetch = FetchType.EAGER)
	private List<Training> trainings;
	
	public Facultative(Integer facultativeId, String name,
			List<project.epam.facultative.app.domain.Training> trainings) {
		
		this.facultativeId = facultativeId;
		this.name = name;
		this.trainings = trainings;
	}
	
	public Integer getFacultativeId() {
		return facultativeId;
	}
	public void setFacultativeId(Integer facultativeId) {
		this.facultativeId = facultativeId;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public List<Training> getTrainings() {
		return trainings;
	}
	public void setTrainings(List<Training> trainings) {
		this.trainings = trainings;
	}
	
	
}
